package com.emqx.controller;

import com.emqx.client.EmqClient;
import com.emqx.enums.QosEnum;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author wangsanhu
 */
@RestController
@RequestMapping("/test")
public class TesttController {

    @Autowired
    private EmqClient emqClient;

    /**
     * 发送一条信息到emq
     */
    @GetMapping("/push")
    public void pushMesg() {
        emqClient.publish("testtopic/abc", "testMsg",
                QosEnum.QoS2, false);

    }
}
